package edu.sctu.zhangwang.month201506.day20150615;


import java.io.*;

/**
 * Created by user10 on 2015/6/15.
 */
public class BufferedUtil {
    public void buffered(){
        int a;
        byte[] bytes = new byte[1024];
        try {
            FileReader fileReader = new FileReader(new File("D://dow.txt"));
            try {
                while ((a=fileReader.read()) !=-1){
                    System.out.println(a);
                }

                fileReader.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    public void shiYan(){
        BufferedReader b = new BufferedReader(new InputStreamReader(System.in));
        System.out.println("输入你的值：");
        String str = null;
        try {
            while (true){
                str = b.readLine();
                if (str.equals("结束")) {
                    break;
                }
                System.out.println("你输入的值为："+str);

            }

        } catch (IOException e) {
            e.printStackTrace();
        }
        try {
            b.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public static void main(String[] args) {
        BufferedUtil bufferedUtil = new BufferedUtil();
//        bufferedUtil.buffered();
        bufferedUtil.shiYan();
    }

}
